﻿@model IEnumerable<SportsStore.Domain.Entities.Product>
@{
ViewBag.Title = "Admin: All Products";
Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<h1>All Products</h1>
<table class="Grid">
    <tr>
        <th>ID</th>
        <th>Name</th>
        <th class="NumericCol">Price</th>
        <th>Actions</th>
    </tr>
    @foreach (var item in Model) {
    <tr>
    <td>@item.ProductID</td>
    <td>@Html.ActionLink(item.Name, "Edit", new { item.ProductID })</td>

    <td class="NumericCol">@item.Price.ToString("c")</td>
    <td>
    @using (Html.BeginForm("Delete", "Admin")) {
    @Html.Hidden("ProductID", item.ProductID)
    <input type="submit" value="Delete"/>
    }
    </td>
</tr>
}
</table>
<br />
<a>Displaying Data Using the WebGrid Helper (with Paging)</a>
<br />
@{  
    var grid = new WebGrid(source: Model, 
                           defaultSort: "Name",  
                           rowsPerPage: 3); 
    grid.SortDirection = SortDirection.Ascending;
}
<div id="grid"> 
            @grid.GetHtml( 
                tableStyle: "grid", 
                headerStyle: "head", 
                alternatingRowStyle: "alt", 
                columns: grid.Columns(
                             grid.Column("Name", "Product", format: @<i>@item.Name</i>),
                                     grid.Column("Description", format: @<i>@item.Description</i>),
                                     grid.Column("Price", format: @<text>$@item.Price</text>)
                                 )
                             ) 
        </div> 

<br />
 <img src="/Admin/GetChartProductosPorcategoria" />
<br />
<p>@Html.ActionLink("Add a new product", "Create")</p>

@section Footer {

<a href="www.google.com">CopyRight</a>
}

